#include <iostream>

using namespace std;

/*
 * 电脑类
 * 电脑的组成零件(CPU,显卡，内存条)抽象类
 * 组装电脑
 */

class AbstractCPU{
public:
    virtual void CPU() = 0;
};

class AbstractNvidia{
public:
    virtual void Nvidia() = 0;
};

class AbstractMemory{
public:
    virtual void Memory() = 0;
};

class LenovoCPU: public AbstractCPU{
public:
    void CPU(){
        cout << "联想的CPU开始工作" << endl;
    }
};

class LenovoNvidia: public AbstractNvidia{
public:
    void Nvidia(){
        cout << "联想的显卡开始工作" << endl;
    }
};

class LenovoMemory: public AbstractMemory{
public:
    void Memory(){
        cout << "联想的内存条开始工作" << endl;
    }
};

class IntelCPU: public AbstractCPU{
public:
    void CPU(){
        cout << "Intel的CPU开始工作" << endl;
    }
};

class IntelNvidia: public AbstractNvidia{
public:
    void Nvidia(){
        cout << "Intel的显卡开始工作" << endl;
    }
};

class IntelMemory: public AbstractMemory{
public:
    void Memory(){
        cout << "Intel的内存条开始工作" << endl;
    }
};

class Computer{
public:
    AbstractCPU * ac;
    AbstractNvidia * an;
    AbstractMemory * am;
    Computer(AbstractCPU * abstractCpu, AbstractNvidia * abstractNvidia, AbstractMemory * abstractMemory){
        ac = abstractCpu;
        an = abstractNvidia;
        am = abstractMemory;
    }

    void doWork(){
        ac->CPU();
        an->Nvidia();
        am->Memory();
    }
};

void test01(){
    LenovoCPU lc;
    LenovoNvidia ln;
    LenovoMemory lm;
    IntelCPU ic;
    IntelNvidia in;
    IntelMemory im;

    Computer c1 = Computer(&lc, &in, &lm);
    Computer c2 = Computer(&ic, &in, &lm);
    Computer c3 = Computer(&lc, &ln, &im);

    c1.doWork();
    cout << "---------------------------" << endl;
    c2.doWork();
    cout << "---------------------------" << endl;
    c3.doWork();
}

int main() {

    test01();

    return 0;
}
